<nz-card class="m-b-2">
  <div class="common-search-wrap">
    <div class="common-search-forms">
      <div class="common-form-item">
        <label class="common-search-label">状态</label>
        <div class="common-search-conrol">
          <nz-select nzShowSearch nzAllowClear nzPlaceHolder="全部" [(ngModel)]="seachParams.state">
            <nz-option nzLabel="未领完" nzValue="0"></nz-option>
            <nz-option nzLabel="已过期" nzValue="1"></nz-option>
            <nz-option nzLabel="已领完" nzValue="2"></nz-option>
          </nz-select>
        </div>
      </div>

      <div class="common-form-item">
        <label class="common-search-label">创建日期</label>
        <div class="common-search-conrol">
          <nz-range-picker
            [(ngModel)]="dateArrs"
            (ngModelChange)="timeChange($event)">
          </nz-range-picker>
        </div>
      </div>

      <div class="common-form-item">
        <button nz-button nzType="primary" class="m-r-8" [nzLoading]="tableParams.tableLoading" (click)="seachData()">查询</button>
        <button nz-button nzType="default" (click)="resetData()">重置</button>
        <!-- <button nz-button nzType="link" (click)="isCollapse = !isCollapse">
          {{ isCollapse ? '收起' : '展开' }}<i nz-icon [nzType]="isCollapse ? 'up' : 'down'" nzTheme="outline"></i>
        </button> -->
      </div>
    </div>
  </div>
</nz-card>

<nz-card>
  <!-- table -->
  <div class="pagination-wrap-position">
    <div class="table-wrap">
      <nz-table
        #basicTable
        nzSize="small"
        nzShowSizeChanger
        nzShowQuickJumper
        nzOuterBordered
        [nzFrontPagination]="false"
        [nzLoadingDelay]="100"
        [nzLoading]="tableParams.tableLoading"
        [nzData]="tableData"
        [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
        [nzTotal]="tableParams.total"
        [nzPageIndex]="tableParams.page"
        [nzPageSize]="tableParams.pageSize"
        [nzShowTotal]="totalTemplate"
        (nzPageIndexChange)="onPageIndexChange($event)"
        (nzPageSizeChange)="onPageSizeChange($event)"
      >
        <thead>
          <tr>
            <th nzAlign="center">发起人</th>
            <th nzAlign="center">礼包ID</th>
            <th nzAlign="center">手机壳</th>
            <th nzAlign="center">领取人数</th>
            <th nzAlign="center">创建时间</th>
            <th nzAlign="center">状态</th>
            <th nzAlign="center">操作</th>
          </tr>
        </thead>

        <tbody>
          <tr *ngFor="let data of basicTable.data; let index = index;">
            <td nzAlign="center">{{ data.nickname || '-' }}</td>
            <td nzAlign="center">{{ data.redPacketId }}</td>
            <td nzAlign="center">{{ data.content || '-' }}</td>
            <!-- 领取人数 -->
            <td nzAlign="center">{{ data.remainingPacket | receivedNum: data.totalPacket }} / {{ data.totalPacket }}</td>
            <td nzAlign="center">{{ data.createTime || '-' }}</td>
            <td nzAlign="center">{{ data.state | claimStatus }}</td>
            <td nzAlign="center">
              <button nz-button nzType="link" (click)="jumpPage(data.id)">查看</button>
            </td>
          </tr>
        </tbody>
      </nz-table>

      <!-- 分页template -->
      <ng-template #totalTemplate let-total>共有 {{ tableParams.total }} 条</ng-template>
    </div>
  </div>
</nz-card>